<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/users' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理表格</el-breadcrumb-item>
    </el-breadcrumb>

    <!-- 用户权限信息表格区域 -->
    <el-card>
      <template>
        <el-table
          :data="tableData"
          style="width: 100%"
          border
        >
          <el-table-column type="index">
          </el-table-column>
          <el-table-column
            prop="authName"
            label="权限名称"
            width="300"
          >
          </el-table-column>
          <el-table-column
            prop="path"
            label="路径"
            width="300"
          >
          </el-table-column>
          <el-table-column
            width="300"
            label="权限等级"
          >
            <template slot-scope="scope">
              <el-tag v-show='scope.row.level === "0"'>一级</el-tag>
              <el-tag
                type="success"
                v-show='scope.row.level === "1"'
              >二级</el-tag>
              <el-tag
                type="warning"
                v-show='scope.row.level === "2"'
              >三级</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </el-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      tableData: []
    }
  },
  created () {
    this.getRightsInfo()
  },
  methods: {
    async getRightsInfo () {
      const { data: res } = await this.$http.get('rights/list')
      this.tableData = res.data
    }
  }
}
</script>

<style>
</style>
